/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package kasus1pendaftaranyudisium;

import java.util.ArrayList;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author sony
 */
public class TableModelYudisium extends AbstractTableModel {

    private String coloumNames[] = {"nama", "nim", "no_hp", "prodi_mahasiswa ", "bulan_yudisium", "haril_yudisium",
        "tanggal_yudisium", "daftar_nilai", "naskah_TA", "bebaspinjam_lab", "bebaspinjam_dosen", "laporan_KP",
        "toelf/TKBI", "suratket_KKL/KI", "filesuratket_bebaspinjam", "keterangan"};
    private ArrayList<Mahasiswa> data;

    public TableModelYudisium() {
    }

    public TableModelYudisium(ArrayList<Mahasiswa> data) {
        this.data = data;
    }

    @Override
    public int getRowCount() {
        return getData().size();
    }

    @Override
    public int getColumnCount() {
        return coloumNames.length;
    }

    public String getColoumNames(int kolom) {
        return coloumNames[kolom];
    }

    public ArrayList<Mahasiswa> getData() {
        return data;
    }

    public void setData(ArrayList<Mahasiswa> data) {
        this.data = data;
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        Mahasiswa mhs = getData().get(rowIndex);
        if (columnIndex == 0) {
            return mhs.getNama();
        } else if (columnIndex == 1) {
            return mhs.getNim();
        } else if (columnIndex == 2) {
            return mhs.getNoHp();
        } else if (columnIndex == 3) {
            return mhs.getProdi();
        } else if (columnIndex == 4) {
            return mhs.getBulan();
        } else if (columnIndex == 5) {
            return mhs.getHari();
        } else if (columnIndex == 6) {
            return mhs.getTanggal();
        } else if (columnIndex == 7) {
            return mhs.getDaftar_nilai();
        } else if (columnIndex == 8) {
            return mhs.getNaskah_ta();
        } else if (columnIndex == 9) {
            return mhs.getBebaspinjam_lab();
        } else if (columnIndex == 10) {
            return mhs.getBebaspinjam_dosen();
        } else if (columnIndex == 11) {
            return mhs.getBukti_kp();
        } else if (columnIndex == 12) {
            return mhs.getToelf_tkbi();
        } else if (columnIndex == 13) {
            return mhs.getKet_kkl();
        } else if (columnIndex == 14) {
            return mhs.getFile_ket();
        } else {
            return mhs.getKeterngan();
        }
    }
}
